/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.spakehelpdesk.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author leehoanh
 */
@Entity
@Table(name = "NewType", catalog = "HelpDesk", schema = "dbo")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "NewType.findAll", query = "SELECT n FROM NewType n"),
    @NamedQuery(name = "NewType.findByNewTypeID", query = "SELECT n FROM NewType n WHERE n.newTypeID = :newTypeID"),
    @NamedQuery(name = "NewType.findByNewTypeName", query = "SELECT n FROM NewType n WHERE n.newTypeName = :newTypeName"),
    @NamedQuery(name = "NewType.findBySymbol", query = "SELECT n FROM NewType n WHERE n.symbol = :symbol")})
public class NewType implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue
    @Basic(optional = false)
    @NotNull
    @Column(name = "NewTypeID", nullable = false)
    private Integer newTypeID;
    @Size(max = 50)
    @Column(name = "NewTypeName", length = 50)
    private String newTypeName;
    @Size(max = 5)
    @Column(name = "Symbol", length = 5)
    private String symbol;
    @Lob
    @Size(max = 1073741823)
    @Column(name = "Description", length = 1073741823)
    private String description;
    @OneToMany(mappedBy = "newTypeID")
    private List<News> newsList;

    public NewType() {
    }

    public NewType(Integer newTypeID) {
        this.newTypeID = newTypeID;
    }

    public Integer getNewTypeID() {
        return newTypeID;
    }

    public void setNewTypeID(Integer newTypeID) {
        this.newTypeID = newTypeID;
    }

    public String getNewTypeName() {
        return newTypeName;
    }

    public void setNewTypeName(String newTypeName) {
        this.newTypeName = newTypeName;
    }

    public String getSymbol() {
        return symbol;
    }

    public void setSymbol(String symbol) {
        this.symbol = symbol;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @XmlTransient
    public List<News> getNewsList() {
        return newsList;
    }

    public void setNewsList(List<News> newsList) {
        this.newsList = newsList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (newTypeID != null ? newTypeID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof NewType)) {
            return false;
        }
        NewType other = (NewType) object;
        if ((this.newTypeID == null && other.newTypeID != null) || (this.newTypeID != null && !this.newTypeID.equals(other.newTypeID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.spakehelpdesk.entity.NewType[ newTypeID=" + newTypeID + " ]";
    }
    
}
